package com.ihr360.commons.filter;

import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;

import java.io.IOException;

/**
 * @author david
 */
public class EnumTypeFilter implements TypeFilter {
    public EnumTypeFilter() {
    }

    @Override
    public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException {
        try {
            return Class.forName(metadataReader.getClassMetadata().getClassName()).isEnum();
        } catch (ClassNotFoundException var4) {
            return false;
        }
    }
}